const Ajax = function( method, url, callback ){

  var xhr = new XMLHttpRequest()
  xhr.open(method, url, true)
  xhr.withCredentials = true
  xhr.send()
  xhr.onreadystatechange = function(){

    if((xhr.readyState == XMLHttpRequest.DONE) && (xhr.status == 200)){
      callback(JSON.parse(xhr.responseText))
    }else{
      callback({error:false})
    }
  }
}
export default Ajax
